"use strict";
exports.__esModule = true;
// store负责调用reducer，然后保存state
/**
 * 在每一个应用中都只有一个Store和一个顶层Reducer
 */
var Store = /** @class */ (function () {
    function Store(reducer, initializeState) {
        this.reducer = reducer;
        this._state = initializeState;
    }
    Store.prototype.getState = function () {
        return this._state;
    };
    /**
     * dispatch函数不反悔任何值，它只负责更新state
     * @param action
     */
    Store.prototype.dispatch = function (action) {
        this._state = this.reducer(this._state, action);
    };
    return Store;
}());
exports.Store = Store;
